Optimal. Leaf size=114 \[ -\frac {b (4 a-b) \tanh ^{-1}\left (\frac {\sqrt {a-b} \sin (c+d x)}{\sqrt {a}}\right )}{2 a^{3/2} d (a-b)^{5/2}}+\frac {b^2 \sin (c+d x)}{2 a d (a-b)^2 \left (a-(a-b) \sin ^2(c+d x)\right )}+\frac {\sin (c+d x)}{d (a-b)^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.18, antiderivative size = 114, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3676, 390, 385, 208} \[ -\frac {b (4 a-b) \tanh ^{-1}\left (\frac {\sqrt {a-b} \sin (c+d x)}{\sqrt {a}}\right )}{2 a^{3/2} d (a-b)^{5/2}}+\frac {b^2 \sin (c+d x)}{2 a d (a-b)^2 \left (a-(a-b) \sin ^2(c+d x)\right )}+\frac {\sin (c+d x)}{d (a-b)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 208
Rule 385
Rule 390
Rule 3676
Rubi steps
\begin {align*} \int \frac {\cos (c+d x)}{\left (a+b \tan ^2(c+d x)\right )^2} \, dx &=\frac {\operatorname {Subst}\left (\int \frac {\left (1-x^2\right )^2}{\left (a-(a-b) x^2\right )^2} \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac {\operatorname {Subst}\left (\int \left (\frac {1}{(a-b)^2}-\frac {(2 a-b) b-2 (a-b) b x^2}{(a-b)^2 \left (a+(-a+b) x^2\right )^2}\right ) \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac {\sin (c+d x)}{(a-b)^2 d}-\frac {\operatorname {Subst}\left (\int \frac {(2 a-b) b-2 (a-b) b x^2}{\left (a+(-a+b) x^2\right )^2} \, dx,x,\sin (c+d x)\right )}{(a-b)^2 d}\\ &=\frac {\sin (c+d x)}{(a-b)^2 d}+\frac {b^2 \sin (c+d x)}{2 a (a-b)^2 d \left (a-(a-b) \sin ^2(c+d x)\right )}-\frac {((4 a-b) b) \operatorname {Subst}\left (\int \frac {1}{a+(-a+b) x^2} \, dx,x,\sin (c+d x)\right )}{2 a (a-b)^2 d}\\ &=-\frac {(4 a-b) b \tanh ^{-1}\left (\frac {\sqrt {a-b} \sin (c+d x)}{\sqrt {a}}\right )}{2 a^{3/2} (a-b)^{5/2} d}+\frac {\sin (c+d x)}{(a-b)^2 d}+\frac {b^2 \sin (c+d x)}{2 a (a-b)^2 d \left (a-(a-b) \sin ^2(c+d x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.56, size = 119, normalized size = 1.04 \[ \frac {-\frac {\sqrt {a} \sin (c+d x) \left (a^2+a (a-b) \cos (2 (c+d x))+a b+b^2\right )}{(a-b)^2 \left ((a-b) \sin ^2(c+d x)-a\right )}-\frac {b (4 a-b) \tanh ^{-1}\left (\frac {\sqrt {a-b} \sin (c+d x)}{\sqrt {a}}\right )}{(a-b)^{5/2}}}{2 a^{3/2} d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 0.57, size = 451, normalized size = 3.96 \[ \left [-\frac {{\left (4 \, a b^{2} - b^{3} + {\left (4 \, a^{2} b - 5 \, a b^{2} + b^{3}\right )} \cos \left (d x + c\right )^{2}\right )} \sqrt {a^{2} - a b} \log \left (-\frac {{\left (a - b\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {a^{2} - a b} \sin \left (d x + c\right ) - 2 \, a + b}{{\left (a - b\right )} \cos \left (d x + c\right )^{2} + b}\right ) - 2 \, {\left (2 \, a^{3} b - a^{2} b^{2} - a b^{3} + 2 \, {\left (a^{4} - 2 \, a^{3} b + a^{2} b^{2}\right )} \cos \left (d x + c\right )^{2}\right )} \sin \left (d x + c\right )}{4 \, {\left ({\left (a^{6} - 4 \, a^{5} b + 6 \, a^{4} b^{2} - 4 \, a^{3} b^{3} + a^{2} b^{4}\right )} d \cos \left (d x + c\right )^{2} + {\left (a^{5} b - 3 \, a^{4} b^{2} + 3 \, a^{3} b^{3} - a^{2} b^{4}\right )} d\right )}}, \frac {{\left (4 \, a b^{2} - b^{3} + {\left (4 \, a^{2} b - 5 \, a b^{2} + b^{3}\right )} \cos \left (d x + c\right )^{2}\right )} \sqrt {-a^{2} + a b} \arctan \left (\frac {\sqrt {-a^{2} + a b} \sin \left (d x + c\right )}{a}\right ) + {\left (2 \, a^{3} b - a^{2} b^{2} - a b^{3} + 2 \, {\left (a^{4} - 2 \, a^{3} b + a^{2} b^{2}\right )} \cos \left (d x + c\right )^{2}\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{6} - 4 \, a^{5} b + 6 \, a^{4} b^{2} - 4 \, a^{3} b^{3} + a^{2} b^{4}\right )} d \cos \left (d x + c\right )^{2} + {\left (a^{5} b - 3 \, a^{4} b^{2} + 3 \, a^{3} b^{3} - a^{2} b^{4}\right )} d\right )}}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 1.89, size = 152, normalized size = 1.33 \[ -\frac {\frac {b^{2} \sin \left (d x + c\right )}{{\left (a^{3} - 2 \, a^{2} b + a b^{2}\right )} {\left (a \sin \left (d x + c\right )^{2} - b \sin \left (d x + c\right )^{2} - a\right )}} + \frac {{\left (4 \, a b - b^{2}\right )} \arctan \left (-\frac {a \sin \left (d x + c\right ) - b \sin \left (d x + c\right )}{\sqrt {-a^{2} + a b}}\right )}{{\left (a^{3} - 2 \, a^{2} b + a b^{2}\right )} \sqrt {-a^{2} + a b}} - \frac {2 \, \sin \left (d x + c\right )}{a^{2} - 2 \, a b + b^{2}}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.62, size = 118, normalized size = 1.04 \[ \frac {\frac {\sin \left (d x +c \right )}{a^{2}-2 a b +b^{2}}+\frac {b \left (-\frac {b \sin \left (d x +c \right )}{2 a \left (a \left (\sin ^{2}\left (d x +c \right )\right )-b \left (\sin ^{2}\left (d x +c \right )\right )-a \right )}-\frac {\left (4 a -b \right ) \arctanh \left (\frac {\left (a -b \right ) \sin \left (d x +c \right )}{\sqrt {a \left (a -b \right )}}\right )}{2 a \sqrt {a \left (a -b \right )}}\right )}{\left (a -b \right )^{2}}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 15.55, size = 269, normalized size = 2.36 \[ \frac {\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (2\,a^2+b^2\right )}{a\,{\left (a-b\right )}^2}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5\,\left (2\,a^2+b^2\right )}{a\,{\left (a-b\right )}^2}+\frac {2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (-2\,a^2+4\,a\,b+b^2\right )}{a\,{\left (a-b\right )}^2}}{d\,\left (a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+\left (4\,b-a\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+\left (4\,b-a\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+a\right )}+\frac {b\,\mathrm {atan}\left (\frac {2{}\mathrm {i}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^3-6{}\mathrm {i}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2\,b+6{}\mathrm {i}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b^2-2{}\mathrm {i}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^3}{\sqrt {a}\,{\left (a-b\right )}^{5/2}\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}\right )\,\left (4\,a-b\right )\,1{}\mathrm {i}}{2\,a^{3/2}\,d\,{\left (a-b\right )}^{5/2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\cos {\left (c + d x \right )}}{\left (a + b \tan ^{2}{\left (c + d x \right )}\right )^{2}}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________